import json

from kafka import KafkaConsumer
import time


def consumer_demo():
    consumer = KafkaConsumer(
        'my_favorite_topic2',
        bootstrap_servers=':9092',
        auto_offset_reset="earliest"
    )
    for message in consumer:
        print("receive, key: {}, value: {}".format(
            message.key,
            message.value
        )
        )


if __name__ == '__main__':
    consumer_demo()
